package com.sgai.zero_robot.database;

import android.content.Context;


import java.util.List;

public class ZeroDetectionRepository {

    private static ZeroDetectionDao taskDao;
    public static void init(Context context){
        AppDatabase db = AppDatabase.getInstance(context);
        taskDao = db.taskDao();
    }

    // 增
    public void insertZeroDetection(ZeroDetectionEntity zeroDetectionEntity) {
        taskDao.upsert(zeroDetectionEntity);
    }

    public List<ZeroDetectionEntity> getAll() {
        return taskDao.getAll();
    }
    public  List<ZeroDetectionEntity> getByParams(String lineName,String towerNum,int install,int phase,int insulator){
        return taskDao.getByValue( lineName, towerNum, install, phase, insulator);
    }
    public void deleteByParams(String lineName, String towerNum, int install){
        taskDao.deleteByParams(lineName,towerNum,install);
    }
    public void deleteAll() {
        taskDao.deleteAll();
    }
}
